import com.pbking.util.eventHandling.EventBroadcaster;
import mx.services.PendingCall;
import com.pbking.util.Proxy;
import com.pbking.util.eventHandling.Event;

/**
 * @author Jason Crist
 */
class com.pbking.web.WebserviceCall extends EventBroadcaster 
{
	
	public var pendingCall:PendingCall;
	
	function WebserviceCall(pendingCall:PendingCall)
	{
		this.pendingCall = pendingCall;
		
		pendingCall.onFault = Proxy.create(this, onFault);
		pendingCall.onResult = Proxy.create(this, onResult);
	}
	
	private function onFault(fault:Object):Void
	{
		dispatch(new Event("fault", this, fault));
	}
	
	private function onResult(result:Object):Void
	{
		dispatch(new Event("result", this, result));
	}
	
}